import 'dotenv/config';
import type { VercelRequest, VercelResponse } from '@vercel/node';
import{RegisterCmd} from "../../dto/index";
import { handleException } from '../../util/exception';
import { register } from '../../service/user/UserService';
import { success } from '../../util/result';

/**
 * 注册接口
 */
export default async (_req: VercelRequest, _res: VercelResponse) => {
    return await handleException(_req,_res,async (request,response) => {
        await register(request.body as RegisterCmd)
        return response.json(success())
    })
}